#include "pinyinconvertertest.h"
#include <QDebug>
PinyinConverterTest::PinyinConverterTest(QObject* parent) : QObject(parent)
{
}
PinyinConverterTest::~PinyinConverterTest()
{
}
void PinyinConverterTest::initTestCase()
{
	qDebug() << "CLASS:PinyinConverter START";
}
void PinyinConverterTest::tstHanzi2PinyinSingal()
{
	auto& conv = PinyinConverter::instance();
	QCOMPARE(conv.cvt2Pinyin(QStringLiteral("你")), QString("ni"));
	QCOMPARE(conv.cvt2Pinyin(QStringLiteral("好")), QString("hao"));
}

void PinyinConverterTest::tstHanzi2PinyinMuti()
{
	auto& conv = PinyinConverter::instance();
	auto res = conv.cvt2Pinyin(QStringLiteral("中国"));
	QCOMPARE(res, QString("zhong guo"));
}

void PinyinConverterTest::tstHanzi2PinyinList()
{
	auto& conv = PinyinConverter::instance();
	auto list = conv.cvt2PinyinList(QStringLiteral("重庆"));
	qDebug () << list << endl;
	QVERIFY(list.contains("chongqing"));
	QVERIFY(list.contains("zhongqing"));
	QCOMPARE(list.size(),2);
}
void PinyinConverterTest::tstHanzi2PinyinCell()
{
	auto& conv = PinyinConverter::instance();
	QCOMPARE(conv.cvt2FirstCell(QStringLiteral("中国")), QString("zg"));
}
void PinyinConverterTest::cleanupTestCase()
{
	qDebug() << "CLASS:PinyinConverter END";
}
int main(int argc, char** argv) {
	PinyinConverterTest tc;
	return QTest::qExec(&tc, argc, argv); // qExec 会把失败信息打印到 stdout
}